import { request } from "@/utils/service"

//#region 主表接口
// 数据字典-列表
export function findListApi(data: any) {
  return request<any>({
    url: "/ocean-base/sysDataDict/findList",
    method: "post",
    data
  })
}

//#endregion

//#region 明细接口
// 明细列表
export function findDetListApi(data: any) {
  return request<any>({
    url: "/ocean-base/sysDataDictDet/findList",
    method: "post",
    data
  })
}

//#endregion

// 查询字典数据列表
export const listData = async (query: any) => {
  return await request({
    url: "/system/dict/data/list",
    method: "get",
    params: query
  })
}

// 查询字典数据详细
export const getData = async (dictCode: string) => {
  return await request({
    url: "/system/dict/data/" + dictCode,
    method: "get"
  })
}

// 根据字典类型查询字典数据信息
// export const getDicts = async (data: any) => {
// 	return await request({
// 		url: "/ocean-base/sysDataDictDet/findList",
// 		method: "post",
// 		data: data,
// 	});
// };

// 新增字典数据
export const addData = async (data: any) => {
  return await request({
    url: "/system/dict/data",
    method: "post",
    data: data
  })
}

// 修改字典数据
export const updateData = async (data: any) => {
  return await request({
    url: "/system/dict/data",
    method: "put",
    data: data
  })
}

// 删除字典数据
export const delData = async (dictCode: string) => {
  return await request({
    url: "/system/dict/data/" + dictCode,
    method: "delete"
  })
}

// 导出字典数据
export const exportData = async (query: any) => {
  return await request({
    url: "/system/dict/data/export",
    method: "get",
    params: query
  })
}
